package com.hkrda523bpwp.hkr_da523b_projekt_pwp;

import java.util.Locale;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class SectionsPagerAdapter extends FragmentPagerAdapter {
	
	Context context;

	public SectionsPagerAdapter(FragmentManager fm, Context context) {
		super(fm);
		this.context = context;
	}

	@Override
	public Fragment getItem(int position) {
		Fragment fragment = new SectionFragment();
		Bundle args = new Bundle();
		args.putInt(SectionFragment.ARG_SECTION_NUMBER, position + 1);
		fragment.setArguments(args);
		return fragment;
	}

	@Override
	public int getCount() {
		return 4;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		Locale l = Locale.getDefault();
		
		switch (position) {
		case 0:
			return context.getString(R.string.title_home).toUpperCase(l);
		case 1:
			return context.getString(R.string.title_movies).toUpperCase(l);
		case 2:
			return context.getString(R.string.title_booking).toUpperCase(l);
		case 3:
			return context.getString(R.string.title_contact).toUpperCase(l);	
		}
		return null;
	}
}
